/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.guide.web;

import com.jeeplus.common.json.AjaxJson;
import com.jeeplus.common.utils.DateUtils;
import com.jeeplus.common.utils.FileUtils;
import com.jeeplus.common.utils.PageBean;
import com.jeeplus.common.utils.StringUtils;
import com.jeeplus.core.web.BaseController;
import com.jeeplus.modules.guide.entity.MobileQueueList;
import com.jeeplus.modules.guide.entity.MobileUserYY;
import com.jeeplus.modules.guide.service.*;
import com.jeeplus.modules.guide.task.Send;
import com.jeeplus.modules.guide.utils.CheckFace;
import com.jeeplus.modules.guide.utils.HttpQueueUtils;
import com.jeeplus.modules.guide.utils.TaskThread;
import com.jeeplus.modules.sys.entity.MobileUserQR;
import com.jeeplus.modules.sys.service.UserService;
import com.jeeplus.modules.sys.utils.Des3Utils;
import com.jeeplus.modules.sys.utils.FileKit;
import com.jeeplus.modules.sys.utils.UserUtils;
import lombok.RequiredArgsConstructor;
import net.sf.json.JSONObject;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.BorderStyle;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;

/**
 * 网上取票Controller
 * @author azj
 * @version 2021-5-15
 */
@RestController
@RequestMapping("/mobileQueueWS")
@RequiredArgsConstructor
public class MobileQueueWSController extends BaseController {
	//排队叫号QueueUrl
	@Value("${QueueUrl}")
	private String QueueUrl;
	//腾讯云 SecretId
	@Value("${SecretId}")
	private String SecretId;
	//腾讯云 SecretKey
	@Value("${SecretKey}")
	private String SecretKey;
	//获取人脸验证url第三方 后台传身份信息验证 一码办成事
	@Value("${faceUrlNoValue}")
	private String faceUrlNoValue;
	//获取人脸验证url第三方 后台传身份信息验证 个人中心
	@Value("${faceUrlNoValueUser}")
	private String faceUrlNoValueUser;
	//获取人脸验证url第三方 后台传身份信息验证 首页
	@Value("${faceUrlNoValueIndex}")
	private String faceUrlNoValueIndex;
	//法人 人脸核身成功跳转路径
	@Value("${faceUrlFR}")
	private String faceUrlFR;
	//是否为人才判断
	@Value("${userCheckRC}")
	private String userCheckRC;
	//获取直接人脸验证后台传身份信息验证 自助取件柜人脸验证页面 跳转业务处理
	@Value("${faceUrlNoValueQR}")
	private String faceUrlNoValueQR;
	private final UserService userService;
	private final MobileQueueService mobileQueueService;
	private final MobileSilentService mobileSilentService;
	private final Send send;
	/**
	 * 添加网上取票数据
	 *
	 * @return
	 */
	@GetMapping("intoUserQR")
	public AjaxJson  intoUserQR(String typeNumber,String orgrizeId) {
		HashMap<String,Object> mapResult = new HashMap<>();
		if(null == UserUtils.getUser()){
			mapResult.put("message","用户未登录");
			return AjaxJson.error("用户未登录").put("code",400).put("data",mapResult);
		}
		MobileUserQR qr = userService.getUserIdcard(UserUtils.getUser().getLoginName());
		if(null == qr){
			mapResult.put("message","用户未绑定");
			return AjaxJson.error("用户未绑定").put("code",400).put("data",mapResult);
		}
		if(mobileQueueService.findUserQueue(typeNumber,orgrizeId,qr.getIdcard()) >= 1){
			mapResult.put("message","该身份证还有未办结件!");
			return AjaxJson.error("该身份证还有未办结件！").put("code",400).put("data",mapResult);
		}
		try{
			//0否 1是 人才判断
			int isRC = Des3Utils.toCheckUserRC(qr.getIdcard(), userCheckRC);
			//调用记录
			userService.intoUserHistory(UserUtils.getUser().getLoginName(),"人才核对","返回结果:"+isRC+"(0否 1是)","无","无",UserUtils.getUser().getPhone());
			if(isRC >= 1){
				//人才记录添加
				mobileQueueService.intoRCUser(qr.getIdcard());
				//获取人才相关业务预约编号
				String result = typeNumber = mobileQueueService.findTypeNo(orgrizeId,typeNumber);
				if(StringUtils.isNotBlank(result))typeNumber = result;

			}
		}catch (Exception e){
			logger.error("人才判断失败："+e.getMessage());
		}
		synchronized(this) {
			JSONObject json = null;
			String result = HttpQueueUtils.intoQueue(QueueUrl, qr.getIdcard(), qr.getName(), typeNumber, orgrizeId);
			//调用记录
			userService.intoUserHistory(UserUtils.getUser().getLoginName(),"线上取号","返回结果:"+result,typeNumber,orgrizeId,UserUtils.getUser().getPhone());
			if (StringUtils.isNotBlank(result)) {
				try {
					json = JSONObject.fromObject(result);
					if(result.contains("second")){
						result = json.getString("second");
						json = JSONObject.fromObject(result).getJSONObject("data");
					}else{
						result = json.getString("data");
						json = JSONObject.fromObject(result);
					}
						//添加记录
						String number = json.getString("number");
						mobileSilentService.insertGXValue(number, orgrizeId, UserUtils.getUser().getLoginName(), null, null,qr.getTell(),0);
						//添加线上取号记录
					    mobileSilentService.insertOnLine(number, orgrizeId, UserUtils.getUser().getLoginName(), null, null,qr.getTell(),0);

					     //判断是否已发送排队信息
						//获取排队结果
						//异步短信发送
						Map<String, Object> map = mobileSilentService.getQueueValue(number, orgrizeId);
						map.put("num",map.get("num"));
						String areaNameValue = mobileSilentService.findAreaNameValue(orgrizeId);
					    send.intoWaitPersonHistory(orgrizeId,number,qr.getTell(),Integer.parseInt(String.valueOf(map.get("num"))),"");
						if(StringUtils.isNotBlank(areaNameValue)){
							number += "("+areaNameValue+")";
						}
						//send.sendSMSQueueInfo(qr.getTell(),number,map);
						send.getWXInfo();
						send.sendWXInfo(UserUtils.getUser().getLoginName(),number,map,qr.getTell(),orgrizeId);
						mapResult.put("number",number);
						mapResult.put("num",map.get("num"));
						mapResult.put("areaName",map.get("areaName"));
						mapResult.put("typeName",map.get("typeName"));
						mapResult.put("waitTime",map.get("waitTime"));
						mapResult.put("waitDoTime",map.get("waitDoTime"));
					    mapResult.put("appraiseStatus",2);
						return AjaxJson.success().put("data",mapResult);
				} catch (Exception e) {
					logger.error("orgrizeId:"+orgrizeId+"添加排队编号失败！result:"+result+"message:"+e.getMessage());
					mapResult.put("message","请勿重复取号!");
				}
			}else{
				mapResult.put("message","网络延迟，请稍后再试!");
			}
		}
		mapResult.put("appraiseStatus",3);
		return AjaxJson.error("请勿重复操作！").put("code", 400).put("data",mapResult);
	}

	/**
	 * 添加网上取票数据
	 *
	 * @return
	 */
	@GetMapping("checkUserRC")
	public AjaxJson  checkUserRC() {
		MobileUserQR qr = userService.getUserIdcard(UserUtils.getUser().getLoginName());
		//0否 1是 人才判断
		if(Des3Utils.toCheckUserRC(qr.getIdcard(), userCheckRC) >= 1){
			return AjaxJson.success().put("isRC",true);
		}else{
			return AjaxJson.success().put("isRC",false);
		}
	}

	/**
	 * 添加网上预约取票数据
	 *
	 * @return
	 */
	@GetMapping("intoUserQRYY")
	public AjaxJson  intoUserQRYY(String typeNumber,String orgrizeId,String id) {
		if(null == UserUtils.getUser()){
			return AjaxJson.error("用户未登录");
		}
		MobileUserQR qr = userService.getUserIdcard(UserUtils.getUser().getLoginName());
		if(null == qr){
			return AjaxJson.error("用户未绑定");
		}
		if(null == mobileQueueService.checkUserYY(qr.getIdcard(), orgrizeId)){
			return AjaxJson.error("当前时间段暂无预约业务!").put("code", 400);
		}
		synchronized(this) {
			JSONObject json = null;
			String result = HttpQueueUtils.intoQueue(QueueUrl, qr.getIdcard(), qr.getName(), typeNumber, orgrizeId);
			logger.error("【"+qr.getIdcard()+"】预约/线上取号："+result);
			if (StringUtils.isNotBlank(result)) {
				try {
					json = JSONObject.fromObject(result);
					if(result.contains("second")){
						result = json.getString("second");
						json = JSONObject.fromObject(result).getJSONObject("data");
					}else{
						result = json.getString("data");
						json = JSONObject.fromObject(result);
					}
						//添加记录
						String number = json.getString("number");
						mobileQueueService.updateUserYY(id, number);
						Boolean flag = mobileSilentService.insertValue(number, orgrizeId, UserUtils.getUser().getLoginName(), null, null,qr.getTell(),0);
						if(flag){
							//判断是否已发送排队信息
							//获取排队结果
							//异步短信发送
							Map<String, Object> map = mobileSilentService.getQueueValue(number, orgrizeId);
							map.put("num",Integer.parseInt(String.valueOf(map.get("num"))));
							String areaNameValue = mobileSilentService.findAreaNameValue(orgrizeId);
							if(StringUtils.isNotBlank(areaNameValue)){
								number += "("+areaNameValue+")";
							}
							//send.sendSMSQueueInfo(qr.getTell(),number,map);
							send.getWXInfo();
							send.sendWXInfo(UserUtils.getUser().getLoginName(),number,map,qr.getTell(),orgrizeId);
							return AjaxJson.success("预约取票成功！");
						}
				} catch (Exception e) {
					logger.error("预约取票失败！idcard:"+qr.getIdcard()+";message:"+e.getMessage());
				}
			}
		}
		return AjaxJson.error("预约取票失败！");
	}

	/**
	 * getBussNumberById 获取点位信息
	 *
	 * @author azj
	 * @version 2020-04-24
	 */
	@GetMapping("/getBussNumberById")
	public AjaxJson getBussNumberById(String id) {
		HashMap<String,String> map = mobileQueueService.getBussNumberById(id);
		if(map != null){
			return AjaxJson.success().put("data",map);
		}else{
			return AjaxJson.error("暂未获取该预约业务数据！").put("code", 400);
		}
	}




	/**
	 * export 导出excel文件
	 * areaId 点位id
	 * pageNo 页数
	 * pageSize 页数大小
	 * @author azj
	 * @version 2020-04-24
	 */
	@GetMapping(value ="export")
	public AjaxJson export(String areaId,String beginWorkTime,String endWorkTime,HttpServletRequest request, HttpServletResponse response) {
		String fileName = "办件统计"+DateUtils.getDate("yyyyMMddHHmmss")+".xlsx";
		Map<String,Object> map = new HashMap<>();
		map.put("pageNo","1");
		map.put("pageSize",1800);
		map.put("areaId",areaId);
		map.put("userid","%"+UserUtils.getUser().getId()+"%");
		map.put("orderBy","cometime asc");
		if(StringUtils.isNotBlank(beginWorkTime))
			map.put("beginWorkTime",beginWorkTime+" 00:00:00");
		if(StringUtils.isNotBlank(endWorkTime))
			map.put("endWorkTime",endWorkTime+" 23:59:59");
		//创建excle
		HSSFWorkbook wb = new HSSFWorkbook();
		HSSFCellStyle cellStyle = wb.createCellStyle();//设置样式
		cellStyle.setBorderBottom(BorderStyle.THIN);//设置下边框
		cellStyle.setBorderLeft(BorderStyle.THIN);//设置左边框
		cellStyle.setBorderRight(BorderStyle.THIN);//设置右边框
		cellStyle.setBorderTop(BorderStyle.THIN);//设置上边框
		cellStyle.setBottomBorderColor((short)1);//设置边框颜色
		cellStyle.setAlignment(HorizontalAlignment.CENTER);//居中
		//通过HSSFWorkbook创建一个HSSFFont
		HSSFFont font = wb.createFont();
        //设置一个字体的颜色2表示红色3表示绿色4表示蓝色5表示黄色6表示紫色7表示亮蓝色8表示黑色9表示白色
		font.setColor((short)8);
		//设置字体的风格：仿宋_GB2312、黑体
		font.setFontName("黑体");
         //设置一个字体的大小,此数值的取值与Excel中的字体大小取值一样
		font.setFontHeightInPoints((short) 12);
		cellStyle.setWrapText(true);//设置自动换行
		//设置背景色
		cellStyle.setFillForegroundColor((short) 13);
		cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        //把该字体应用到当前的样式
		font.setBold(true);
		cellStyle.setFont(font);
		String[] data = {"排队号码", "受理状态", "叫号状态", "受理窗口", "员工工号", "员工姓名", "业务名称", "取号时间", "叫号时间", "受理时间", "结束时间", "评价","身份证号"};
		HSSFSheet sheet = wb.createSheet("办件统计");
		//设置列宽，其中width表示Excel中的列宽值
		//firstRow：起始行 lastRow：结束行 firstCol：起始列 lastCol：结束列
		//CellRangeAddress region = new CellRangeAddress(int firstRow, int lastRow, int firstCol, int lastCol);
		//sheet.addMergedRegion(region);
		try {
			HSSFRow row = null;
			HSSFCell hc = null;
			List<MobileQueueList> list = null;
			row = sheet.createRow(0);
			for(int i =0;i<data.length;i++){
				hc = row.createCell(i);
				hc.setCellStyle(cellStyle);
				hc.setCellValue(data[i]);
				sheet.setColumnWidth(i, 4000); //第一个参数代表列id(从0开始),第2个参数代表宽度值
			}
			PageBean<MobileQueueList> pages = mobileQueueService.getQueueList(map);
			int num = 1;
			list = pages.getDatas();
			ExecutorService pool = null;
			//加载第一次数据集合进入excle
			for(int key=0;key<list.size();key++){
				row = sheet.createRow(num);
				row.createCell(0).setCellValue(list.get(key).getNumber());
				row.createCell(1).setCellValue(list.get(key).getStatus());
				row.createCell(2).setCellValue(list.get(key).getDoStatus());
				row.createCell(3).setCellValue(list.get(key).getWino());
				row.createCell(4).setCellValue(list.get(key).getUserNo());
				row.createCell(5).setCellValue(list.get(key).getUserName());
				row.createCell(6).setCellValue(list.get(key).getTypeName());
				row.createCell(7).setCellValue(list.get(key).getCometime());
				row.createCell(8).setCellValue(list.get(key).getHjtime());
				row.createCell(9).setCellValue(list.get(key).getServertime());
				row.createCell(10).setCellValue(list.get(key).getEndtime());
				row.createCell(11).setCellValue(list.get(key).getPjstatus());
				row.createCell(12).setCellValue(list.get(key).getIdcard());
				num++;
			}
			//加载第2次数据集合进入excle
			if(pages.getTotalPageSize() == 2){
				map.put("pageNo","2");
				list = mobileQueueService.getQueueList(map).getDatas();
				for(int key=0;key<list.size();key++){
					row = sheet.createRow(num);
					row.createCell(0).setCellValue(list.get(key).getNumber());
					row.createCell(1).setCellValue(list.get(key).getStatus());
					row.createCell(2).setCellValue(list.get(key).getDoStatus());
					row.createCell(3).setCellValue(list.get(key).getWino());
					row.createCell(4).setCellValue(list.get(key).getUserNo());
					row.createCell(5).setCellValue(list.get(key).getUserName());
					row.createCell(6).setCellValue(list.get(key).getTypeName());
					row.createCell(7).setCellValue(list.get(key).getCometime());
					row.createCell(8).setCellValue(list.get(key).getHjtime());
					row.createCell(9).setCellValue(list.get(key).getServertime());
					row.createCell(10).setCellValue(list.get(key).getEndtime());
					row.createCell(11).setCellValue(list.get(key).getPjstatus());
					num++;
				}
			}else{
				//加载大于2页数据集合进入excle 启动多线程
				pool = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), 2*Runtime.getRuntime().availableProcessors(), 10, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(1000),Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy());
				for(int i=2;i<=pages.getTotalPageSize();i++){
					map.put("pageNo",i+"");
					pool.execute(new TaskThread(sheet,mobileQueueService.getQueueList(map).getDatas(),(i-1)*1800+1));
				}
			}
			//文档输出
			String fileDir = FileKit.getAttachmentDir()+"gxzw/excle/queue/";
			FileUtils.createDirectory(fileDir);
			fileDir = fileDir+fileName;
			FileOutputStream out = new FileOutputStream(fileDir);
			wb.write(out);
			out.flush();
			out.close();
			//关闭多线程
			if(null != pool){
				pool.shutdown();
			}
			return AjaxJson.success().put("url",fileDir.substring(fileDir.indexOf("userfiles"),fileDir.length()));
		}catch (Exception e){}
		return AjaxJson.error("导出失败！");
	}

	/**
	 * getQueueList 获取窗口人员办件统计
	 * areaId 点位id
	 * pageNo 页数
	 * pageSize 页数大小
	 * @author azj
	 * @version 2020-04-24
	 */
	@GetMapping(value ="getQueueList")
	public AjaxJson getQueueList(String wino,String idcard,String areaId,int pageNo,int pageSize,String orderBy,String beginWorkTime,String endWorkTime) {
		Map<String,Object> map = new HashMap<>();
		map.put("pageNo",pageNo);
		map.put("pageSize",pageSize);
		map.put("idcard",idcard);
		map.put("areaId",areaId);
		map.put("wino",wino);
		map.put("userid","%"+UserUtils.getUser().getId()+"%");
		if(StringUtils.isNotBlank(orderBy))
			map.put("orderBy",orderBy);
		if(StringUtils.isNotBlank(beginWorkTime))
			map.put("beginWorkTime",beginWorkTime+" 00:00:00");
		if(StringUtils.isNotBlank(endWorkTime))
			map.put("endWorkTime",endWorkTime+" 23:59:59");
		return AjaxJson.success("加载成功！").put("data", mobileQueueService.getQueueListByIdcare(map));
	}

	/**
	 * findAllPJ 获取窗口差评统计
	 * areaId 点位id
	 * pageNo 页数
	 * pageSize 页数大小
	 * @author azj
	 * @version 2020-04-24
	 */
	@GetMapping(value ="findAllPJ")
	public AjaxJson findAllPJ(String areaId,String wino,String pj,String number,String pageNo,String pageSize,String beginWorkTime,String endWorkTime) {
		if(StringUtils.isNotBlank(beginWorkTime)){
			beginWorkTime+=" 00:00:00";
		}else{
			beginWorkTime = DateUtils.getDate()+" 00:00:00";
		}
		if(StringUtils.isNotBlank(endWorkTime)){
			endWorkTime+=" 00:00:00";
		}else{
			endWorkTime = DateUtils.getDate()+" 23:59:59";
		}
		return AjaxJson.success("加载成功！").put("data", mobileQueueService.findAllPJ(areaId,wino,pj,number,pageNo,pageSize,beginWorkTime,endWorkTime));
	}

	/**
	 * 获取直接人脸验证后台传身份信息验证 一码办成事页面
	 */
	@RequiresPermissions("user")
	@GetMapping("getNoCardNameUrl")
	public AjaxJson getNoCardNameUrl() {
		if(null == UserUtils.getUser()){
			return AjaxJson.error("用户未登录").put("code",400);
		}
		HashMap <String, String> list = userService.getUserValueById(UserUtils.getUser().getId());
		if(null == list){
			return AjaxJson.error("获取人脸验证url失败！" );
		}
		String message = CheckFace.getNoCardNameUrl(SecretId, SecretKey, faceUrlNoValue+UserUtils.getUser().getLoginName(),list.get("name"),list.get("idcard"));
		if (message == null) {
			return AjaxJson.error("获取人脸验证url失败！" + message);
		} else {
			JSONObject obj = JSONObject.fromObject(message);
			if (org.apache.commons.lang.StringUtils.isNotBlank(obj.getString("Url"))) {
				return AjaxJson.success().put("url", obj.getString("Url"));
			} else {
				logger.error("获取人脸验证url失败！" + message);
				return AjaxJson.error("获取人脸验证url失败！" + message);
			}
		}
	}

	/**
	 * 获取直接人脸验证后台传身份信息验证 自助取件柜人脸验证页面
	 */
	@RequiresPermissions("user")
	@GetMapping("getNoCardNameUrlQR")
	public AjaxJson getNoCardNameUrlQR() {
		if(null == UserUtils.getUser()){
			return AjaxJson.error("用户未登录").put("code",400);
		}
		HashMap <String, String> list = userService.getUserValueById(UserUtils.getUser().getId());
		if(null == list){
			return AjaxJson.error("获取人脸验证url失败！" );
		}
		String message = CheckFace.getNoCardNameUrl(SecretId, SecretKey, faceUrlNoValueQR+UserUtils.getUser().getLoginName(),list.get("name"),list.get("idcard"));
		if (message == null) {
			return AjaxJson.error("获取人脸验证url失败！" + message);
		} else {
			JSONObject obj = JSONObject.fromObject(message);
			if (org.apache.commons.lang.StringUtils.isNotBlank(obj.getString("Url"))) {
				return AjaxJson.success().put("url", obj.getString("Url"));
			} else {
				logger.error("获取人脸验证url失败！" + message);
				return AjaxJson.error("获取人脸验证url失败！" + message);
			}
		}
	}

	/**
	 * 获取直接人脸验证后台传身份信息验证 个人中心页面
	 */
	@RequiresPermissions("user")
	@GetMapping("getNoCardNameUrlUser")
	public AjaxJson getNoCardNameUrlUser() {
		if(null == UserUtils.getUser()){
			return AjaxJson.error("用户未登录").put("code",400);
		}
		HashMap <String, String> list = userService.getUserValueById(UserUtils.getUser().getId());
		if(null == list){
			return AjaxJson.error("获取人脸验证url失败！" );
		}
		String message = CheckFace.getNoCardNameUrl(SecretId, SecretKey, faceUrlNoValueUser+UserUtils.getUser().getLoginName(),list.get("name"),list.get("idcard"));
		if (message == null) {
			return AjaxJson.error("获取人脸验证url失败！" + message);
		} else {
			JSONObject obj = JSONObject.fromObject(message);
			if (org.apache.commons.lang.StringUtils.isNotBlank(obj.getString("Url"))) {
				return AjaxJson.success().put("url", obj.getString("Url"));
			} else {
				logger.error("获取人脸验证url失败！" + message);
				return AjaxJson.error("获取人脸验证url失败！" + message);
			}
		}
	}

	/**
	 * 获取直接人脸验证后台传身份信息验证 个人中心页面
	 */
	@RequiresPermissions("user")
	@GetMapping("getNoCardNameUrlIndex")
	public AjaxJson getNoCardNameUrlIndex() {
		if(null == UserUtils.getUser()){
			return AjaxJson.error("用户未登录").put("code",400);
		}
		HashMap <String, String> list = userService.getUserValueById(UserUtils.getUser().getId());
		if(null == list){
			return AjaxJson.error("获取人脸验证url失败！" );
		}
		String message = CheckFace.getNoCardNameUrl(SecretId, SecretKey, faceUrlNoValueIndex+UserUtils.getUser().getLoginName(),list.get("name"),list.get("idcard"));
		if (message == null) {
			return AjaxJson.error("获取人脸验证url失败！" + message);
		} else {
			JSONObject obj = JSONObject.fromObject(message);
			if (org.apache.commons.lang.StringUtils.isNotBlank(obj.getString("Url"))) {
				return AjaxJson.success().put("url", obj.getString("Url"));
			} else {
				logger.error("获取人脸验证url失败！" + message);
				return AjaxJson.error("获取人脸验证url失败！" + message);
			}
		}
	}

	/**
	 * 获取直接人脸验证后台传身份信息验证
	 */
	@RequiresPermissions("user")
	@GetMapping("getNoCardNameUrlRZ")
	public AjaxJson getNoCardNameUrlRZ() {
		if(null == UserUtils.getUser()){
			return AjaxJson.error("用户未登录").put("code",400);
		}
		HashMap <String, String> list = userService.getUserValueById(UserUtils.getUser().getId());
		if(null == list){
			return AjaxJson.error("获取人脸验证url失败！" );
		}
		String message = CheckFace.getNoCardNameUrl(SecretId, SecretKey, faceUrlFR+UserUtils.getUser().getLoginName(),list.get("name"),list.get("idcard"));
		if (message == null) {
			return AjaxJson.error("获取人脸验证url失败！" + message);
		} else {
			JSONObject obj = JSONObject.fromObject(message);
			if (org.apache.commons.lang.StringUtils.isNotBlank(obj.getString("Url"))) {
				return AjaxJson.success().put("url", obj.getString("Url"));
			} else {
				logger.error("获取人脸验证url失败！" + message);
				return AjaxJson.error("获取人脸验证url失败！" + message);
			}
		}
	}

}
